package com.gamehouse.eggpoacher;

import java.util.ArrayList;

import com.gamehouse.eggpoacher.R;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
    private Context mContext;
    ArrayList<ImageView> imageList = new ArrayList<ImageView>();
   

    public ImageAdapter(Context c) {
        mContext = c;
        
    }

    public int getCount() {
        return mThumbIds.length;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    // create a new ImageView for each item referenced by the Adapter
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(90, 108));
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            imageView.setPadding(2, 2, 2, 2);
            imageView.setImageResource(mThumbIds[position]);
            imageList.add(imageView);
            imageView.setVisibility(View.INVISIBLE);
            
           
        } else {
            imageView = (ImageView) convertView;
        }

        
        
        //imageView.setVisibility(View.INVISIBLE);
        return imageView;
    } 

    
    // references to our images
    private Integer[] mThumbIds = {
            R.drawable.ovo_branco, R.drawable.ovo_branco,
            R.drawable.ovo_branco, R.drawable.ovo_branco,
            R.drawable.ovo_branco, R.drawable.ovo_branco,
            R.drawable.ovo_branco, R.drawable.ovo_branco,
            R.drawable.ovo_branco, R.drawable.ovo_branco,
            R.drawable.ovo_branco, R.drawable.ovo_branco
    };
    
    public ArrayList<ImageView> getImageList () {
    	return imageList;
    }  
}
